<template>
  <CesiumBox ref="container"></CesiumBox>
</template>

<script setup>
import CesiumBox from "../../components/CesiumBox.vue";
import { ref, onMounted } from "vue";
import * as Cesium from "cesium";

const container = ref(null);
let cesiumPara = null;

function addPiperser() {
  cesiumPara.viewer.scene.primitives.add(
    new Cesium.Cesium3DTileset({
      url: process.env.VUE_APP_TOMCAT + "/cesium/pipeser/tileset.json",
    })
  );
}

onMounted(() => {
  cesiumPara = container.value.cesiumPara;
  addPiperser();

  cesiumPara.viewer.camera.flyTo({
    destination: Cesium.Cartesian3.fromDegrees(
      110.96591469343898,
      30.818160023263555,
      306.32219062760566
    ),
    orientation: {
      heading: 0.3760158215615448,
      pitch: -0.41640731203374015,
      roll: 6.283179903802607,
    },
    duration: 3,
  });
});
</script>
